package com.dealglobe.feeder.bvd.query;

import com.bvdep.webservices.RemoteAccessSoap;
import com.bvdep.webservices.ResultFormatting;
import com.bvdep.webservices.SelectionResult;

public class BvdQueryExecutor {
    private final RemoteAccessSoap ws;
    private final String sessionHandle;

    public BvdQueryExecutor(RemoteAccessSoap ws, String sessionHandle) {
        this.ws = ws;
        this.sessionHandle = sessionHandle;
    }

    public SelectionResult find(BvdQuery query) {
       return ws.find(sessionHandle, query.getSelectionId(), query.getParammeters()); 
    }
    
    public String getData(BvdQuery query, SelectionResult selection, int nrRecords) {
        return ws.getData(sessionHandle, selection, query.getGetData(), 0, nrRecords, ResultFormatting.CSV);
    }
}
